namespace Common;

/// <summary>
/// 业务异常类
/// </summary>
/// <remarks>
/// 用于抛出业务逻辑相关的异常，会被全局异常过滤器捕获并转换为统一响应格式
/// </remarks>
public class BusinessException : Exception
{
    /// <summary>
    /// 错误消息
    /// </summary>
    public string ErrorMessage { get; }

    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="message">错误消息</param>
    public BusinessException(string message) : base(message)
    {
        ErrorMessage = message;
    }

    /// <summary>
    /// 构造函数（包含内部异常）
    /// </summary>
    /// <param name="message">错误消息</param>
    /// <param name="innerException">内部异常</param>
    public BusinessException(string message, Exception innerException) : base(message, innerException)
    {
        ErrorMessage = message;
    }
}
